package com.dianxin.smartpark.web.attendance;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.chinatelecom.response.common.CommonResponseBody;
import com.dianxin.smartpark.dao.qo.attendance.SmartParkVacationTypeQO;
import com.dianxin.smartpark.service.attendance.SmartParkVacationTypeService;
import com.dianxin.smartpark.service.vo.attendance.SmartParkVacationTypeVO;
import com.dianxin.sso.client.annotation.RecordLog;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 假期类型
 * @program: smart-park
 * @description: 假期类型
 * @author: chenyong
 * @create: 2021-07-23 11:19
 */
@RestController
@RequestMapping("/smartpark/attendance/VacationType")
public class SmartParkVacationTypeController {

    @Resource
    private SmartParkVacationTypeService smartParkVacationTypeService;

    /**
     * 假期类型分页查询
     * @Description:  假期类型分页查询
     * @Author: ChenYong
     * @Date: 2021/7/23 0023
     * @param smartParkVacationTypeQO:
     * @Return: CommonResponseBody<List<SmartParkVacationTypeVO>>
     */
    @PostMapping("/getHolidayDetails")
    @RecordLog(name = "假期类型查询")
    @SaCheckPermission("/attendance/VacationType/getHolidayDetails")
    public CommonResponseBody<List<SmartParkVacationTypeVO>> getHolidayDetails(@RequestBody SmartParkVacationTypeQO smartParkVacationTypeQO) {
        return smartParkVacationTypeService.getVacationTypes(smartParkVacationTypeQO);
    }

    /**
     * 添加假期类型
     * @Description:  添加假期类型
     * @Author: ChenYong
     * @Date: 2021/7/23 0023
     * @param smartParkVacationTypeQO:
     * @Return: CommonResponseBody
     */
    @PostMapping("/saveVacationType")
    @RecordLog(name = "假期类型添加")
    @SaCheckPermission("/attendance/VacationType/saveVacationType")
    public CommonResponseBody saveVacationType(@RequestBody SmartParkVacationTypeQO smartParkVacationTypeQO) {
        return smartParkVacationTypeService.saveVacationType(smartParkVacationTypeQO);
    }

    /**
     * 修改假期类型
     * @Description:  修改假期类型
     * @Author: ChenYong
     * @Date: 2021/7/23 0023
     * @param smartParkVacationTypeQO:
     * @Return: CommonResponseBody
     */
    @PostMapping("/updateVacationType")
    @RecordLog(name = "假期类型修改")
    @SaCheckPermission("/attendance/VacationType/updateVacationType")
    public CommonResponseBody updateVacationType(@RequestBody SmartParkVacationTypeQO smartParkVacationTypeQO){
        return smartParkVacationTypeService.updateVacationType(smartParkVacationTypeQO);
    }

    /**
     * 根据ID删除假期类型
     * @Description:  根据ID删除假期类型
     * @Author: ChenYong
     * @Date: 2021/7/23 0023
     * @param smartParkVacationTypeQO:
     * @Return: CommonResponseBody
     */
    @PostMapping("/deleteVacationType")
    @RecordLog(name = "假期类型删除")
    @SaCheckPermission("/attendance/VacationType/deleteVacationType")
    public CommonResponseBody deleteVacationType(@RequestBody SmartParkVacationTypeQO smartParkVacationTypeQO){
        return smartParkVacationTypeService.deleteVacationType(smartParkVacationTypeQO.getIds());
    }

    /**
     * 根据ID查询假期类型详情信息
     * @Description:  根据ID查询假期类型详情信息
     * @Author: ChenYong
     * @Date: 2021/7/30 0030
     * @param smartParkVacationTypeQO:
     * @Return: CommonResponseBody
     */
    @PostMapping("/vacationTypeDetails")
    @RecordLog(name = "假期类型详情")
    @SaCheckPermission("/attendance/VacationType/vacationTypeDetails")
    public CommonResponseBody vacationTypeDetails(@RequestBody SmartParkVacationTypeQO smartParkVacationTypeQO){
        return smartParkVacationTypeService.vacationTypeDetails(smartParkVacationTypeQO);
    }
}
